<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>账号管理</title>
    <%@ include file="/commons/meta.jsp"%>
    <link href="${ctx}/resources/admin/css/base.css" rel="stylesheet">
    <link href="${ctx}/resources/admin/css/zTreeStyle.css" rel="stylesheet">
</head>
<body>
<div id="loading" class="loading" >数据加载中…</div>
<div id="shade-div" class="shade-div hide"></div>
<%@ include file="/jsps/admin/inc/header.jsp"%>
<%@ include file="/jsps/admin/inc/menu.jsp"%>
<div id="main">
    <div id="content">
    <div class="hd">
        <span>账号管理</span>

    </div>
    <div class="search-box">
        <form id="form1" action="" method="post">
            <input type="text" class="itext gray" id="searchBy" name="userCode,name" value="输入姓名、账号等进行查询" v="">
            <button class="btn blue-btn" type="submit" id="searchButton">查询</button>
        </form>
        <button class="btn blue-btn fr" id="newAccount">新增账户</button>
    </div>
    <table class="table-list">
        <tr>
            <th>账户</th>
            <th>姓名</th>
            <th>部门</th>
            <th>用户角色</th>
            <th>操作</th>
        </tr>
        <s:iterator value="pager.result" status="i" var="ss">
	        <tr>
	            <td><s:property value="userCode" /></td>
	            <td><s:property value="name" /></td>
	            <td title="${ss.deptname}">
	            <s:if test="%{null!=deptname&&deptname.length()>20}">
                      <s:property value="%{deptname.substring(0, 19)}" />……
           		</s:if>
           		<s:else>
           			${ss.deptname}
           		</s:else>
	            </td>
	            <td><s:property value="role.name" /></td>
	            <td> 
	            <s:if test="role.id!=1">
	             	<s:if test="#session.USERINFO.id!=id">
		            	<a href="javascript:;" class="edit" value="<s:property value="id"/>">编辑账户</a> &nbsp;&nbsp; 
		            	<a href="javascript:;" class="del" value="<s:property value="id"/>">删除账户</a>
	            	</s:if>
	            </s:if>
	            </td>
	        </tr>
	    </s:iterator>
    </table>
	<jsp:include page="/jsps/admin/inc/pager.jsp">
		<jsp:param name="pageUrl" value="${ctx}/account/account!list.xhtml" />
	</jsp:include>
</div>
</div>
<%@ include file="/jsps/admin/inc/footer.jsp"%>
<!--新增账户-->
<div class="popbox w650" id="addAccount" >
    <div class="popbox-hd">
        <h2>新增账户</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div>
    	<form id="saveForm">
    		<input type="hidden" value="" id="saveForm_deptIds" name="deptIds">
    		<input type="hidden" value="" id="saveForm_funcIds" name=funcIds>
	        <div class="popbox-bd ">
	            <p id="validate"><label>管理员账号：</label><input type="text" class="itext" id="addUserCode" name="userCode"><span></span></p>
	            <p><label>管理员角色：</label>
	            <select id="roleid" name="roleid" style="margin-left: -4px;">
	            <s:iterator value="roleList" status="i" var="r">
	            	<s:if test="id!=1">
		            <option value="${r.id}">${r.name}</option>
		            </s:if>
		        </s:iterator>
	            </select>
	            </p>
	            <p><label>密码：</label><input type="password" class="itext" id="pwd" name="pwd"></p>
	            <p><label>确认密码：</label><input type="password" class="itext" id="surepwd"></p>
	            <p><label>备注信息：</label><textarea name="remark"></textarea></p>
	            <div class="clearfix" style="border: 1px solid #ccc;padding: 10px;width: 500px;margin: 0 auto">
	                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;padding: 10px;float: left;margin-left: 3px">
	                    <h2 style="font-size: 14px;font-weight: normal;text-align: center">设置部门</h2>
	                    <ul id="treeDemo1" class="ztree">
	                    </ul>
	                </div>
	                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;padding: 10px;float: right;margin-right: 3px;">
	                    <h2 style="font-size: 14px;font-weight: normal;text-align: center">设置功能</h2>
	                    <ul id="treeDemo2" class="ztree">
	                    </ul>
	                </div>
	            </div>
	        </div>
	        <div class="popbox-ft">
	            <a id="saveButton" href="javascript:;" class="btn blue-btn">完成</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
	        </div>
        </form>
    </div>

</div>

<!--账户编辑-->
<div class="popbox w650" id="editAccount" >
    <div class="popbox-hd">
        <h2>账户编辑</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div>
    	<form id="editForm">
    		<input type="hidden" value="" id="editForm_deptIds" name="deptIds">
    		<input type="hidden" value="" id="editForm_funcIds" name="funcIds">
    		<input type="hidden" value="" id="editForm_userId" name="userInfo.id">
	        <div class="popbox-bd ">
	            <p><label>管理员账号：</label><input type="text" class="itext" value="" id="editUserCode" readonly="readonly" disabled="false"></p>
	            <p><label>管理员角色：</label>
	            <select name="roleid" id="editRoleid" style="margin-left: -4px;" disabled="false">
	            <s:iterator value="roleList" status="i" var="r" >
		          		            <option value="${r.id}">${r.name}</option>
		          
		        </s:iterator>
	            </select>
	            </p>
	            <p><label>密码：</label><input type="password" class="itext" id="editpwd" name="pwd"></p>
	            <p><label>备注信息：</label><textarea id="editRemark" name="remark"></textarea></p>
	            <div class="clearfix" style="border: 1px solid #ccc;padding: 10px;width: 500px;margin: 0 auto">
	                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;padding: 10px;float: left;margin-left: 3px">
	                    <h2 style="font-size: 14px;font-weight: normal;text-align: center">部门权限</h2>
	                    <ul id="treeDemo3" class="ztree">
	                    </ul>
	                </div>
	                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;padding: 10px;float: right;margin-right: 3px;">
	                    <h2 style="font-size: 14px;font-weight: normal;text-align: center">功能权限</h2>
	                    <ul id="treeDemo4" class="ztree">
	                    </ul>
	                </div>
	            </div>
	        </div>
	        <div class="popbox-ft">
	            <a href="javascript:;" class="btn blue-btn" id="editButton">保存修改</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
	        </div>
        </form>
    </div>
</div>

<!--警告框-->
<div class="popbox w300" id="warning" >
	<input id="sureDelId" value="" type="hidden"/>
    <div class="popbox-hd">
        <h2>警告</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div class="popbox-bd">
        <p class="center"></p>
    </div>
    <div class="popbox-ft">
        <a href="javascript:;" class="btn blue-btn" id="sureDelButton">确定</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
    </div>
</div>
<script src="${ctx}/resources/admin/js/lib/jquery-1.8.0.min.js"></script>
<script src="${ctx}/resources/admin/js/lib/jquery-ui.js"></script>
<script src="${ctx}/resources/admin/js/lib/jquery.ztree.core-3.1.min.js"></script>
<script src="${ctx}/resources/admin/js/lib/jquery.ztree.excheck-3.1.min.js"></script>
<script src="${ctx}/resources/admin/js/lib/jquery.ztree.exedit-3.1.min.js"></script>
<script src="${ctx}/resources/admin/js/common.js"></script>
<script src="${ctx}/resources/admin/js/account/account.js"></script>
<script src="${ctx}/resources/admin/js/lib/ztree.js"></script>
<script type="text/javascript">
if("${pager.keyword}"!=""){
	$("#searchBy").val("${pager.keyword}");
	$("#searchBy").removeClass("gray");
	$("#searchBy").addClass("borderRed");
}
$(function(){
	common.menuClicked('P1', 'C2');
});
</script>
</body>
</html>